/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.stub;

import edu.fpt.entity.Employee;
import edu.fpt.session.EmployeeFacadeLocal;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author TuanAnh
 */
public class LoginStub {

    EmployeeFacadeLocal emp = lookupEmployeeFacadeLocal();
    
     public boolean checkLogin(String id, String pass){
        return emp.checkLogin(id, pass);
    }     
     public List<Employee> getALlEmp(){
         return emp.findAll();
     }

    private EmployeeFacadeLocal lookupEmployeeFacadeLocal() {
        try {
            Context c = new InitialContext();
            return (EmployeeFacadeLocal) c.lookup("java:global/ProjectManagementHotel/ProjectManagementHotel-ejb/EmployeeFacade!edu.fpt.session.EmployeeFacadeLocal");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
